# Maintainer: Keith Toh <ktprograms@gmail.com>
pkgname=py3-sphinx-argparse
pkgver=0.3.1
pkgrel=1
pkgdesc="Sphinx extension that automatically documents argparse commands and options"
url="https://sphinx-argparse.readthedocs.io/en/latest/"
arch="noarch"
license="MIT"
depends="python3 py3-sphinx"
makedepends="py3-build py3-installer py3-poetry-core py3-wheel"
checkdepends="py3-pytest"
source="sphinx-argparse-$pkgver.tar.gz::https://github.com/ashb/sphinx-argparse/archive/refs/tags/$pkgver.tar.gz
	fix-python3.10-tests.patch"
builddir="$srcdir/sphinx-argparse-$pkgver"

build() {
	# XXX: hack for poetry to not ignore files
	GIT_DIR=. python3 -m build --no-isolation --wheel
}

check() {
	pytest -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		dist/sphinx_argparse-$pkgver-py2.py3-none-any.whl
	install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

sha512sums="
3d289c90165eb6a3d7a94dff8e6a429a49eb404ce373e80e007a0cd9abaae1e1236f5393df2fbf11701c349dade9d199640dc398064da4fd50a58a90eb3f8f12  sphinx-argparse-0.3.1.tar.gz
790aef1651fcb5160058e8359b13368fbbbb01dafe8d792187e942a542f5cce9b84d1c44b85f75782f373b9ce3dca976ed703fb496f6f8fe52dd6708038edc29  fix-python3.10-tests.patch
"
